home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
076-100
/
scopedisk89
/
typetut
/
ck.bas
< prev
next >
Wrap
BASIC Source File
|
1995-03-19
|
14KB
|
354 lines
1 REM COMPUTER KEYBOARDING PROGRAM -- DICTATION DISC COMPANY 2/83
2 REM COURSE DEVELOPED BY FRANK DONNELY
3 REM MODIFIED FOR COMPUTER BY JOHN VISAGGI
4 REM PROGRAMMED BY LOUIS SOLOMON
5 REM Adapted to AmigaBasic by Bart Westra 1989 (search for 'AAA')
9 WIDTH 255 'SETS INFINITE WIDTH - NO FORMFEEDS
10 GOSUB 50 'CALL INTIALIZATION
20 GOTO 1000 'START PROGRAM
50 REM **** INITIALIZATION ROUTINE ****
51 DIM T$(10,80),LASTCOL%(25),ROW$(25),REPS%(100),TI%(100)
52 DIM STARTL%(100),STARTD%(100),ROWLINE%(100),TYPE$(100),RE%(100)
60 REM **** SCREEN CODE INITS
65 REV$=CHR$(20):HOME$=CHR$(2):FF$=CHR$(12) 'AAA deleted CLS$=CHR$(4)
66 SH=23:SW=79 'SCREEN HEIGHT AND WIDTH
68 FOR X=1 TO 38:DILINE$=DILINE$+"- ":NEXT X
70 REM **** TIMING LOOP CONSTANTS
72 REM MINAMT=4800 'MINUTE AMOUNT ' AAA - old minamt
73 MINAMT=60 'MINUTE AMOUNT IN SECONDS 'AAA - for timer
74 TSAMT=MINAMT/2 '30 SECOND AMOUNT
76 TCONSTANT=1/MINAMT 'TIME CONSTANT
78 RETTIME=3 'TIME FOR RETURN KEY
80 BSTIME=3 'TIME FOR BACKSPACE KEY
82 BCTIME=3 'TIME FOR BAD CHARACTER
84 ADDTIME=8.3 'TIME FOR CORRECT CHARACTER
90 RETURN
100 REM **** CURSOR POSITIONING ROUTINE -- PASS R & C AS ROW/COLUMN
102 IF INT(R)<>R OR INT(C)<>C OR R>SH OR C>SW THEN RETURN
104 LOCATE R+1,C+1 'AAA - replaced ANSI seq chr$(27+128;C+128;R+128)
108 RETURN
120 REM **** PLACE CURSOR AT PARTICULAR ENTRY POSITION
121 REM PASS STARTING ROW,NUMBER OF ROWS IN DRILL,ROW AND COLUMN
122 R=STARTROW+NOROWS+X+1:C=Y:GOSUB 100
128 RETURN
130 REM **** BRING TEXT IN FROM LESSON FILE
131 REM NOTE THAT OFFSET OF 1 TO COMPENSATE FOR SPACE BETWEEN LESSONS
132 NOROWS=STARTL%(LES+1)-STARTL%(LES)-1 'NUMBER OF LINES IN LESSON
134 COUNTER=0
140 FOR X=STARTL%(LES)+1 TO STARTL%(LES+1)-1
141 COUNTER=COUNTER+1
142 ROW$(COUNTER)=""
143 GET #1,X
146 ROW$(COUNTER)=R$
147 REM PRINT COUNTER,ROW$(COUNTER)
148 NEXT X
149 RETURN
150 REM **** BRING TEXT IN FROM DRILLS
151 REM NOTE THAT NOROWS AND STARTLES TAKE INTO ACCOUNT THE $$$$
152 NOROWS=STARTD%(LES+1)-STARTD%(LES)-1:COUNTER=0
153 IF NOROWS<=0 THEN NOROWS=STARTD%(LES+2)-STARTD%(LES)-1
154 IF NOROWS<=0 THEN NOROWS=STARTD%(LES+3)-STARTD%(LES)-1
155 FOR X=STARTD%(LES)+1 TO STARTD%(LES)+NOROWS
156 COUNTER=COUNTER+1
158 ROW$(COUNTER)=""
162 GET #2,X
163 ROW$(COUNTER)=D$
165 LASTCOL%(COUNTER)=INSTR(ROW$(COUNTER),">")-1
166 NEXT X
167 RETURN
210 REM **** PRINT TEXT IN PROPER POSITION
211 FOR X=1 TO NOROWS
212 R=STARTROW+X-1:C=1:GOSUB 100
213 LC=INSTR(ROW$(X),">")-1
216 IF LC<1 THEN LC=0
217 PRINT LEFT$(ROW$(X),LC)
218 NEXT X
219 RETURN
220 REM **** WAIT FOR PARTICULAR CHARACTER NON-TIMED
222 A$=INKEY$:IF LEN(A$)=0 THEN 222
224 IF ASC(A$)=8 THEN BACKSP=1
225 IF ASC(A$)=13 THEN RET=1
226 IF ASC(A$)=27 THEN ESC=1
229 RETURN
300 REM **** CHARACTER ENTRY TIMED ****
301 GOTO 400 'AAA - USE TIMER FUNCTION
314 A$=INKEY$
318 IF START=1 THEN AAATIME=AAATIME+1
320 IF AAATIME>TIMELIMIT THEN OVER=1:RETURN
324 IF LEN(A$)=0 THEN 314
326 CHARCOUNT=CHARCOUNT+1
328 A=ASC(A$)
332 IF A=13 THEN RET=1:AAATIME=AAATIME+RETTIME:RETURN
334 IF A=8 THEN BACKSP=1:AAATIME=AAATIME+BSTIME:RETURN
335 IF A=27 THEN ESC=1:AAATIME=AAATIME+1:RETURN
336 IF A<32 OR A>126 THEN AAATIME=AAATIME+BCTIME:GOTO 314
340 IF START=0 THEN START=1:AAATIME=0
344 IF START=1 THEN AAATIME=AAATIME+ADDTIME:NRM=1
352 RETURN
400 REM AAA - **** CHARACTER ENTRY TIMED FOR AMIGA (USE TIMER FUNCION ) ****
414 A$=INKEY$
418 IF START=1 THEN AAATIME=TIMER-STARTTIME
419 IF AAATIME<0 THEN AAATIME=AAATIME+86400 'AAA - Our typist works late!
420 IF AAATIME>TIMELIMIT THEN OVER=1:RETURN
424 IF LEN(A$)=0 THEN 414
426 CHARCOUNT=CHARCOUNT+1
428 A=ASC(A$)
432 IF A=13 THEN RET=1:RETURN
434 IF A=8 THEN BACKSP=1:RETURN
435 IF A=27 THEN ESC=1:RETURN
436 IF A<32 OR A>126 THEN 414
440 IF START=0 THEN START=1:AAATIME=0:STARTTIME=TIMER
444 NRM=1
452 RETURN
480 REM *** PRINT ANY TEXT ON SCREEN
482 GOSUB 130:CLS:GOSUB 210 'AAA - replaced print cls$
486 RETURN
600 REM ****** TIMED TEXT ROUTINE MAIN CALLING ROUTINE
604 STARTROW=0:GOSUB 480 'PRINT LESSON
606 IF STARTD%(LES)=0 THEN 699 'RETURN BACK - NO DRILL
618 TT=1:GOSUB 970 'PROMPT TO START DRILL
619 IF ESC=1 THEN ESC=0:GOTO 660 'AAA - Allow escape from lesson
620 STARTROW=5 'START OF DRILL IS 5
624 REM RUN TIMED TEXT
636 F$=STR$(LES)
640 GOSUB 150 'BRING TEXT IN FROM DRILL
641 FOR COUNTER=1 TO REPS%(LES) 'LOOP FOR NO. OF REPS
642 AAATIME=0:CHARCOUNT=0:OVER=0:AAAOFF=0 'INTIALIZE VALUES
643 IF TI%(LES)=1 THEN TIMELIMIT=TSAMT ELSE TIMELIMIT=MINAMT
644 GOSUB 980 'TITLE OF DRILL
648 GOSUB 210 'PRINT DRILL
650 SR=STARTROW:NR=NOROWS 'SAVE CONSTANTS
652 GOSUB 670 'ACTUAL TIMING
656 GOSUB 860 'TIMING RESULTS ROUTINE
657 IF ESC=1 THEN ESC=0:GOTO 660 'AAA - Allow escape from lesson rep.
659 NEXT COUNTER 'END LOOP REPS%
660 RETURN
670 REM ****** TIMED ENTRY ROUTINE
672 Y=1:START=0:X=0:BACKSP=0:ESC=0:RET=0'INITIALIZE VALUES
674 A$=INKEY$:A$=INKEY$ 'FLUSH KEYBOARD BUFFER
678 IF Y<=1 THEN Y=1 'DONT PASS LEFT EDGE
679 IF Y=SW THEN X=X+1:Y=0 'DONT PASS RIGHT EDGE
680 IF X>=SH THEN X=SH 'DONT PASS BOTTOM
681 GOSUB 120 'PLACE CURSOR AT POSTION
682 GOSUB 300 'GET IN CHARACTER TIMED
684 IF RET=1 THEN X=X+1:Y=1 'PROCESS RETURN
685 IF BACKSP=1 THEN Y=Y-1 'PROCESS BACKSPACE
687 IF OVER=1 THEN OVER=0:RETURN 'PROCESS TIMEOUT
688 IF ESC=1 THEN ESC=0:RETURN 'PROCESS ESCAPE
689 IF NRM=1 THEN PRINT A$;:Y=Y+1 'NORMAL CHARACTER
690 RET=0:BACKSP=0:NRM=0 'INITIALIZE VALUES
692 GOTO 678 'LOOP BACK NEXT CHARACTER
700 REM ***** FREE FORMED TEXT ENTRY MAIN CALLING ROUTINE
705 STARTROW=0:GOSUB 480 'PRINT LESSONS
710 STARTROW=NOROWS+1 'CALCULATE START OF DRILL PLACEMENT
724 GOSUB 150:GOSUB 210 'GET AND PRINT DRILL
727 FOR COUNTER=1 TO REPS%(LES) 'LOOP FOR NUMBER OF REPS
730 GOSUB 740 'FREE FORMED TEXT ENTRY
732 NEXT COUNTER 'END LOOP
738 RETURN 'RETURN
740 REM ****** FREE FORMED TEXT ENTRY ROUTINE
742 Y=1:START=0:X=0:BACKSP=0:ESC=0:RET=0'INITIALIZE VALUES
744 A$=INKEY$:A$=INKEY$ 'FLUSH KEYBOARD BUFFER
748 IF Y<=1 THEN Y=1
749 IF Y=SW THEN X=X+1:Y=0
750 IF X>=SH THEN X=SH
751 GOSUB 120 'PLACE CURSOR AT POSTION
752 GOSUB 220 'GET IN CHARACTER
754 IF RET=1 THEN RET=0:X=X+1:Y=1:GOTO 750
757 IF BACKSP=1 THEN BACKSP=0:Y=Y-1:GOTO 748
758 IF ESC=1 THEN ESC=0:RETURN
759 PRINT A$;:Y=Y+1::GOTO 748
800 REM ****** MENU PROGRAM
810 OPEN "I",#3,"MENU"
812 CLS 'AAA - replaced print cls$
814 IF EOF(3) THEN 820
815 LINE INPUT #3,A$:PRINT A$:GOTO 814
820 CLOSE #3
822 INPUT "Please enter lesson to start from (then press return) ",ST
823 IF ST=99 THEN 3000
824 IF ST=0 THEN RESET:SYSTEM
825 IF ST>100 OR ST<1 OR ST<>INT(ST) THEN 800
826 LES=ST
829 RETURN
830 REM MAIN TITLE
831 OPEN "I",#3,"TITLE"
832 CLS 'AAA - replaced print cls$
833 IF EOF(3) THEN 835
834 LINE INPUT #3,A$:PRINT A$:GOTO 833
835 CLOSE #3
836 S$="Press any key to display menu":PRINT TAB(20);S$
837 B$=INPUT$(1)
838 GOSUB 940
840 RETURN
850 REM DISPLAY ONLY TEXT TYPE
855 STARTROW=0:GOSUB 480
856 STARTROW=NOROWS+1:GOSUB 740 'GET ENTRY
859 RETURN
860 REM *** TIMING RESULTS SUBROUTINE
861 FOR X=1 TO NR 'ERASE TIMING PARAGRAPH
862 R=SR+X-1:C=1:GOSUB 100
863 PRINT STRING$(78," ");
864 NEXT X
876 WORDS=INT(CHARCOUNT/5+.5)
877 IF AAATIME=0 THEN AAATIME=0.001 'AAA - prevent divide by zero in 880
878 MINUTES=AAATIME*TCONSTANT
880 WPM=INT(WORDS/MINUTES+.5)
881 R=2:C=60:GOSUB 100
882 PRINT "Timing ";COUNTER;" of ";REPS%(LES)
883 R=SR:C=0:GOSUB 100 'PLACE CURSOR
884 PRINT "You just typed ";WORDS;"words at ";WPM;" words per minute"
886 IF RE%(LES)>0 AND COUNTER<REPS%(LES) THEN GOSUB 900
887 IF COUNTER<REPS%(LES) THEN GOSUB 890 '15 SECOND PAUSE
888 RETURN
890 REM 15 SECOND PAUSE BETWEEN TIMINGS
891 R=22:C=1:GOSUB 100
892 PRINT "GET READY FOR NEXT TIMING...."; ' AAA - added ; to this line
893 AAATIME=0:START=1:STARTTIME=TIMER ' AAA - added starttime
894 TIMELIMIT=TSAMT/2:GOSUB 300
895 RETURN
900 REM REMARK COMMENTS
901 PRINT
902 P=COUNTER+RE%(LES)-1+AAAOFF
904 GET #2,P
906 L=INSTR(D$,">")-1
908 IF INSTR(D$,"\")>0 THEN NL=1 ELSE NL=0
910 IF NL=1 THEN PRINT LEFT$(D$,L-1) ELSE PRINT LEFT$(D$,L)
920 IF NL=1 THEN GET #2,P+1:L=INSTR(D$,">")-1
922 IF NL=1 THEN PRINT LEFT$(D$,L-1):AAAOFF=AAAOFF+1
925 RETURN
940 REM MESSAGE
942 CLS 'AAA - replaced print cls$;
944 R=10:C=20:GOSUB 100
946 PRINT "Please wait one moment ..."
948 RETURN
950 REM *** WAIT FOR RETURN PROMPT AT BOTTOM
952 R=22:C=1:GOSUB 100
953 REM AAA - added ; to next line
954 PRINT "Press [Return] to Next, [R] to Repeat, [B] to Go Back, [M] to Menu";
956 R=22:C=74:GOSUB 100
957 AAATIME=0:START=0
958 TIMELIMIT=100000!:GOSUB 300:I$=A$
960 IF I$=CHR$(13) THEN LES=LES+1:GOTO 968
962 IF I$="B" OR I$="b" THEN LES=LES-1:GOTO 968
964 IF I$="M" OR I$="m" THEN LES=0:GOTO 968
965 IF I$="R" OR I$="r" THEN LES=LES:GOTO 968
966 GOTO 952
968 RETURN
970 REM IN BETWEEN TIMINGS PROMPT
971 R=22:C=1:GOSUB 100
972 M$="Press [Return] to view timing ... Timing starts when first key pressed"
974 PRINT M$;:R=22:C=70:GOSUB 100
975 AAATIME=0:START=0
976 TIMELIMIT=100000!:GOSUB 300:I$=A$
977 IF ESC=1 THEN R=22:C=1:GOSUB 100:PRINT SPACE$(71);:RETURN 'AAA - line added
978 IF I$=CHR$(13) THEN RETURN ELSE 976 'AAA - this was line 977
980 REM **** TITLE ROUTINE
982 CLS 'AAA - replaced print cls$;
984 S$="DICTATION DISC COMPANY":GOSUB 990
985 S$="COMPUTER KEYBOARDING -- LESSON "+F$:GOSUB 990
986 PRINT DILINE$
987 RETURN
990 REM **** CENTER ON PAGE ROUTINE
992 T=INT(40-LEN(S$)/2)
993 PRINT TAB(T);S$
994 RETURN
1000 REM MAIN BODY OF PROGRAM
1001 OPEN "R",#1,"LESRAN",80:FIELD #1,80 AS R$
1002 OPEN "R",#2,"DRILRAN",80:FIELD #2,80 AS D$
1005 GOSUB 830
1010 FRAMES=84
1012 GOSUB 2000 'STARTING LINE FOR LESSON
1014 GOSUB 2100 'STARTING LINE FOR DRILLS
1016 GOSUB 2200 'COMPUTE STARTING LINE FOR EXACTS
1018 GOSUB 2400 'LESSON INFORMATION
1020 GOSUB 800
1040 REM START OF TYPE CALLING PROGRAMS
1041 IF TYPE$(LES)="T" THEN GOSUB 600
1042 IF TYPE$(LES)="F" THEN GOSUB 700
1043 IF TYPE$(LES)="D" THEN GOSUB 850
1045 GOSUB 950'CALL MENU CHANGE LES
1050 GOSUB 940
1055 A=FRE("A")
1060 IF LES=0 THEN 1020
1070 GOTO 1040
2000 REM GET STARTING LINE FOR LESSONS ARRAY
2010 OPEN "I",#3,"LESST"
2020 FOR X=1 TO FRAMES+1
2030 INPUT #3,LES,START
2040 STARTL%(X)=START
2050 NEXT X
2055 CLOSE #3
2060 RETURN
2100 REM GET STARTING LINE FOR DRILLS ARRAY
2110 OPEN "I",#3,"DRIST"
2130 IF EOF(3) THEN 2160
2135 INPUT #3,LES,START
2140 STARTD%(LES)=START
2150 GOTO 2130
2160 CLOSE #3:RETURN
2200 REM COMPUTE ROWLINE% (START ROW OF DRILLS) ARRAY
2210 FOR X=1 TO FRAMES
2220 N=STARTL%(X+1)-STARTL%(X)-1
2230 ROWLINE%(X)=N+1
2240 NEXT X
2250 RETURN
2400 REM GET LESSON INFORMATION
2410 X=0
2415 OPEN "I",#3,"LESINF"
2420 IF EOF(3) THEN 2460
2425 X=X+1
2430 INPUT #3,A$
2434 TYPE$(X)=LEFT$(A$,1)
2435 REPS%(X)=VAL(MID$(A$,15,5)):IF REPS%(X)=0 THEN REPS%(X)=1
2436 TI%(X)=VAL(MID$(A$,28,6))
2438 Y=VAL(MID$(A$,44,6))
2439 IF Y=0 THEN RE%(X)=0 ELSE RE%(X)=Y+STARTD%(FRAMES+1)-2
2440 GOTO 2420
2460 CLOSE #3
2470 RETURN
3000 REM PRINT OUT LESSONS
3005 INPUT "START AT WHAT LESSON";S:IF S=0 THEN S=1
3006 INPUT "END AT WHAT LESSON";E:IF E=0 THEN E=FRAMES
3010 FOR LES=S TO E
3020 P=1:GOSUB 130:GOSUB 3200
3030 IF TYPE$(LES)<>"D" THEN P=0:GOSUB 150:GOSUB 3200
3031 GOSUB 3400
3035 IF RE%(LES)>0 THEN GOSUB 3300'PRINT REMARKS
3040 NEXT LES
3050 END
3200 REM PRINT TO LINE PRINTER
3210 IF P=1 THEN LPRINT CHR$(12); ELSE LPRINT:LPRINT:LPRINT'FORM FEED
3211 FOR X=1 TO NOROWS
3213 LC=INSTR(ROW$(X),">")-1
3216 IF LC<1 THEN LC=0
3217 LPRINT LEFT$(ROW$(X),LC)
3218 NEXT X
3219 RETURN
3300 REM PRINT REMARKS OUT
3310 LPRINT:LPRINT "===REMARKS===":AAAOFF=0
3315 FOR COUNTER=1 TO REPS%(LES)-1
3316 LPRINT COUNTER;"-- ";
3318 GOSUB 3900
3320 NEXT COUNTER
3330 RETURN
3400 REM PRINT OUT LESSON INFO
3401 LPRINT:LPRINT
3405 LPRINT "===LESSON INFORMATION==="
3410 IF TYPE$(LES)="F" THEN LPRINT "Normal non-timed drill"
3411 IF TYPE$(LES)="T" THEN LPRINT "Timed typing"
3412 IF TYPE$(LES)="D" THEN LPRINT "Display only text"
3415 LPRINT REPS%(LES);" Repetition)"
3416 IF TYPE$(LES)="T" AND TI%(LES)=1 THEN LPRINT "30 seconds each"
3417 IF TYPE$(LES)="T" AND TI%(LES)=2 THEN LPRINT "One minute each"
3418 RETURN
3900 REM REMARK COMMENTS
3901 PRINT
3902 P=COUNTER+RE%(LES)-1+AAAOFF
3904 GET #2,P
3906 L=INSTR(D$,">")-1
3908 IF INSTR(D$,"\")>0 THEN NL=1 ELSE NL=0
3910 IF NL=1 THEN LPRINT LEFT$(D$,L-1) ELSE LPRINT LEFT$(D$,L)
3920 IF NL=1 THEN GET #2,P+1:L=INSTR(D$,">")-1
3922 IF NL=1 THEN LPRINT " ";LEFT$(D$,L-1):AAAOFF=AAAOFF+1
3925 RETURN